package cn.hdmis.security.service.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import cn.hdmis.bean.QueryResult;
import cn.hdmis.dao.BaseDao;
import cn.hdmis.security.service.BaseService;
import cn.hdmis.util.GenericsUtils;

public class BaseServiceImpl<T> implements BaseService<T>{
	private final Logger logger = Logger.getLogger(getClass());
	private BaseDao<T> baseDao;
	
	public BaseDao<T> getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao<T> baseDao) {
		this.baseDao = baseDao;
	}

	@Override
	public void delete(Serializable id) {
		baseDao.delete(id);
	}
	/**
	 * 删除实体
	 * 
	 * @param entityClass
	 *            实体类
	 * @param id
	 *            实体id数组
	 */
	public void deleteEntiey(T entity){
		baseDao.deleteEntiey(entity);
	}
	@Override
	public void deleteList(List<Serializable> idList) {
		// TODO Auto-generated method stub
		baseDao.deleteList(idList);
	}

	@Override
	public List<T> findAllEntity() {
		// TODO Auto-generated method stub
		return baseDao.findAllEntity();
	}

	@Override
	public List<T> findByEntity(Object entiey) {
		// TODO Auto-generated method stub
		return baseDao.findByEntity(entiey);
	}

	@Override
	public T findByID(Serializable entityId) {
		// TODO Auto-generated method stub
		return baseDao.findByID(entityId);
	}

	@Override
	public List<T> findByProperty(String propertyName, Object value) {
		// TODO Auto-generated method stub
		return baseDao.findByProperty(propertyName, value);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult,
			String wherejpql, Object[] queryParams, List<String> orderby) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult, wherejpql, queryParams, orderby);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult,
			Map<String, Object> queryParamsMap, List<String> orderby) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult, queryParamsMap, orderby);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult,
			String wherejpql, Object[] queryParams) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult, wherejpql, queryParams);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult,
			Map<String, Object> queryParamsMap) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult, queryParamsMap);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult,
			List<String> orderby) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult, orderby);
	}

	@Override
	public QueryResult<T> getScrollData(int firstindex, int maxresult) {
		// TODO Auto-generated method stub
		return baseDao.getScrollData(firstindex, maxresult);
	}

	@Override
	public QueryResult<T> getScrollData() {
		// TODO Auto-generated method stub
		return baseDao.getScrollData();
	}

	@Override
	public QueryResult<T> getScrollDataCriteria(int firstindex, int maxresult,
			Map<String, Object> queryParamsMap, List<String> orderby) {
		// TODO Auto-generated method stub
		return baseDao.getScrollDataCriteria(firstindex, maxresult, queryParamsMap, orderby);
	}

	@Override
	public void save(T entity) {
		// TODO Auto-generated method stub
		baseDao.save(entity);
	}

	@Override
	public void saveOrUpdate(T entity) {
		// TODO Auto-generated method stub
		baseDao.saveOrUpdate(entity);
	}

	@Override
	public void update(T entity) {
		// TODO Auto-generated method stub
		baseDao.update(entity);
		
	}
	

}
